<?php
class ListenerComponent extends Object
{
	var $modelAlias;
	
	function initialize(&$controller, $settings) {
		$controller->helpers[] = 'Cms.Listener';
	}

	function startup($controller)
	{
		if($controller->action == 'admin_getStatus')
		{
			Configure::write('debug', 0);
			//$controller->data['ids'] = "1;2;3;";

			$ids = explode(';',$controller->params['form']['ids']);
			
			$conditions = array('id'=>$ids);
			$fields = array('id','status');
			$statuses = $controller->{$this->modelAlias}->find('all', compact('conditions', 'fields'));
			$statuses = Set::combine($statuses, '{n}.'.$this->modelAlias.'.id', '{n}.'.$this->modelAlias.'.status');
			$controller->output = json_encode($statuses);
			$controller->skipDispatch();
			return true;
		}
	}

	
}
?>